const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('act_cmmn_hi_plan_item_inst', {
    id: {
      type: DataTypes.STRING(255),
      allowNull: false,
      primaryKey: true,
      field: 'ID_'
    },
    rev: {
      type: DataTypes.INTEGER,
      allowNull: false,
      field: 'REV_'
    },
    name: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'NAME_'
    },
    state: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'STATE_'
    },
    caseDefId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'CASE_DEF_ID_'
    },
    caseInstId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'CASE_INST_ID_'
    },
    stageInstId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'STAGE_INST_ID_'
    },
    isStage: {
      type: DataTypes.BOOLEAN,
      allowNull: true,
      field: 'IS_STAGE_'
    },
    elementId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'ELEMENT_ID_'
    },
    itemDefinitionId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'ITEM_DEFINITION_ID_'
    },
    itemDefinitionType: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'ITEM_DEFINITION_TYPE_'
    },
    createTime: {
      type: DataTypes.DATE(3),
      allowNull: true,
      field: 'CREATE_TIME_'
    },
    lastAvailableTime: {
      type: DataTypes.DATE(3),
      allowNull: true,
      field: 'LAST_AVAILABLE_TIME_'
    },
    lastEnabledTime: {
      type: DataTypes.DATE(3),
      allowNull: true,
      field: 'LAST_ENABLED_TIME_'
    },
    lastDisabledTime: {
      type: DataTypes.DATE(3),
      allowNull: true,
      field: 'LAST_DISABLED_TIME_'
    },
    lastStartedTime: {
      type: DataTypes.DATE(3),
      allowNull: true,
      field: 'LAST_STARTED_TIME_'
    },
    lastSuspendedTime: {
      type: DataTypes.DATE(3),
      allowNull: true,
      field: 'LAST_SUSPENDED_TIME_'
    },
    completedTime: {
      type: DataTypes.DATE(3),
      allowNull: true,
      field: 'COMPLETED_TIME_'
    },
    occurredTime: {
      type: DataTypes.DATE(3),
      allowNull: true,
      field: 'OCCURRED_TIME_'
    },
    terminatedTime: {
      type: DataTypes.DATE(3),
      allowNull: true,
      field: 'TERMINATED_TIME_'
    },
    exitTime: {
      type: DataTypes.DATE(3),
      allowNull: true,
      field: 'EXIT_TIME_'
    },
    endedTime: {
      type: DataTypes.DATE(3),
      allowNull: true,
      field: 'ENDED_TIME_'
    },
    lastUpdatedTime: {
      type: DataTypes.DATE(3),
      allowNull: true,
      field: 'LAST_UPDATED_TIME_'
    },
    startUserId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'START_USER_ID_'
    },
    referenceId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'REFERENCE_ID_'
    },
    referenceType: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'REFERENCE_TYPE_'
    },
    tenantId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      defaultValue: "",
      field: 'TENANT_ID_'
    },
    entryCriterionId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'ENTRY_CRITERION_ID_'
    },
    exitCriterionId: {
      type: DataTypes.STRING(255),
      allowNull: true,
      field: 'EXIT_CRITERION_ID_'
    }
  }, {
    sequelize,
    tableName: 'act_cmmn_hi_plan_item_inst',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "ID_" },
        ]
      },
    ]
  });
};
